.\"
.\" FreeBSD pkg - a next generation package for the installation and maintenance
.\" of non-core utilities.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\"    notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\"    notice, this list of conditions and the following disclaimer in the
.\"    documentation and/or other materials provided with the distribution.
.\"
.\"
.\"     @(#)pkg.8
.\"
.Dd April 14, 2015
.Dt PKG-LOCK 8
.Os
.Sh NAME
.Nm "pkg lock" ,
.Nm "pkg unlock"
.Nd lock or unlock packages
.Sh SYNOPSIS
.Nm
.Op Fl lqy
.Op Fl a
.Nm
.Op Fl lqy
.Op Fl Cgix
.Ar pkg-name
.Nm "pkg unlock"
.Op Fl lqy
.Op Fl a
.Nm "pkg unlock"
.Op Fl lqy
.Op Fl Cgix
.Ar pkg-name
.Pp
.Nm
.Op Cm --{show-locked,quiet,yes}
.Op Cm --all
.Nm
.Fl -has-locked-packages
.Nm
.Op Cm --{show-locked,quiet,yes}
.Op Cm --{case-sensitive,glob,case-insensitive,regex}
.Ar pkg-name
.Nm "pkg unlock"
.Op Cm --{show-locked,quiet,yes}
.Op Cm --all
.Nm "pkg unlock"
.Op Cm --{show-locked,quiet,yes}
.Op Cm --{case-sensitive,glob,case-insensitive,regex}
.Ar pkg-name
.Sh DESCRIPTION
.Nm
is used to lock packages against reinstallation,
modification or deletion.
.Nm "pkg unlock"
unlocks the named packages.
Either variant only has an effect on currently installed packages.
Consequently it is impossible to block installation of a new package
by using this mechanism, unless such an installation implies updating
a locked package.
.Pp
The impact of locking a package is wider than simply preventing
modifications to the package itself.
.Cm Any
operation implying modification of the locked package will be
blocked.
This includes:
.Pp
.Bl -bullet -compact
.It
Attempts to reinstall, up- or downgrade or delete the locked package
itself.
.It
Installation, up- or downgrade of a package where the resultant
package would have a dependency on a different version of the locked
package.
.It
Deletion, up- or downgrade of any package the locked package depends
upon, either directly or as a consequence of installing or upgrading
some third package.
.El
.Sh OPTIONS
The following options are supported by
.Nm :
.Bl -tag -width all
.It Fl a , Fl --all
Lock or unlock all installed packages.
.It Fl C , Fl -case-sensitive
Make the standard or the regular expression
.Fl ( x )
matching against
.Ar pkg-name
case sensitive.
.It Fl g , Fl -glob
Treat
.Ar pkg-name
as a shell glob pattern.
.It Fl i , Fl -case-insensitive
Make the standard or the regular expression
.Fl ( x )
matching against
.Ar pkg-name
case insensitive.
This is the default, unless modified by setting
.Ev CASE_SENSITIVE_MATCH
to true in
.Pa pkg.conf .
.It Fl l , Fl -show-locked
Show a list of all locked packages.
This can be used without locking or unlocking any packages, in which
case privileged access to the package database is not required.
Otherwise it will be displayed after any lock or unlock operations.
.It Fl q , Fl -quiet
Operate quietly: do not output anything other than confirmatory questions.
.It Fl x , Fl -regex
Treat
.Ar pkg-name
as a regular expression according to the "modern" or "extended" syntax
of
.Xr re_format 7 .
.It Fl y , Fl -yes
Assume "yes" as the answer to all questions.
.It Fl -has-locked-packages
Return 0 if at least one package is locked, 1 otherwise
.El
.Sh ENVIRONMENT
The following environment variables affect the execution of
.Nm .
See
.Xr pkg.conf 5
for further description.
.Bl -tag -width ".Ev NO_DESCRIPTIONS"
.It Ev PKG_DBDIR
.It Ev DEFAULT_ALWAYS_YES
.It Ev ASSUME_ALWAYS_YES
.It Ev CASE_SENSITIVE_MATCH
.El
.Sh FILES
See
.Xr pkg.conf 5 .
.Sh SEE ALSO
.Xr pkg_printf 3 ,
.Xr pkg_repos 3 ,
.Xr pkg-repository 5 ,
.Xr pkg.conf 5 ,
.Xr pkg 8 ,
.Xr pkg-add 8 ,
.Xr pkg-alias 8 ,
.Xr pkg-annotate 8 ,
.Xr pkg-audit 8 ,
.Xr pkg-autoremove 8 ,
.Xr pkg-backup 8 ,
.Xr pkg-check 8 ,
.Xr pkg-clean 8 ,
.Xr pkg-config 8 ,
.Xr pkg-create 8 ,
.Xr pkg-delete 8 ,
.Xr pkg-fetch 8 ,
.Xr pkg-info 8 ,
.Xr pkg-install 8 ,
.Xr pkg-query 8 ,
.Xr pkg-register 8 ,
.Xr pkg-repo 8 ,
.Xr pkg-rquery 8 ,
.Xr pkg-search 8 ,
.Xr pkg-set 8 ,
.Xr pkg-shell 8 ,
.Xr pkg-shlib 8 ,
.Xr pkg-ssh 8 ,
.Xr pkg-stats 8 ,
.Xr pkg-update 8 ,
.Xr pkg-updating 8 ,
.Xr pkg-upgrade 8 ,
.Xr pkg-version 8 ,
.Xr pkg-which 8
